﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>兑换记录</title>
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="keywords" content="销冠,TopSales微信" />
    <meta name="description" content="销冠,TopSales微信,TopSales销冠" />
    <base href="http://static.tops001.com/pointstore/" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.8.1.min.js" type="text/javascript"></script>
    <script src="../jq-bs-art.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="../kk.js" type="text/javascript"></script>
    <style>
        /*#showMesBox {width:90%;padding:20px;min-height:200px;max-width:640px;margin-left:-45%;left:50%;top:250px;position:fixed;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;z-index:99;box-shadow:0 0 2px 2px #ccc;}*/
        #showMesBox .table-responsive{border:none;margin-bottom:0}
        #showMesBox .modal-dialog{margin-top:50px}
        #showMesBox .modal-footer {padding:5px}
        #showMesBox table {color:#333;margin-bottom:0}
        #showMesBox table tr:first-of-type td {border-top:none}
    </style>
    <script type="text/javascript">
        var apiUrl = "http://"+window.location.host+"/";
        $(function () {
            
            kk.api.get(apiUrl + "/ProductsExchange/GetBrokerKidByList", {pageIndex: 1, pageSize: 10 }, function (data) {
                if (data.Items.length <= 0 || data.Items == null || data.Items == "") {
                    str = "<div class='change_empty'>" +
                        "  <img src='images/icon_empty.png' alt='' width='86'/>" +
                        "  <div class='change_txt01'>您还没有任何兑换记录</div>" +
                        "  <div class='change_txt02'><a >去商城逛逛吧!</a></div>" +
                        "</div>"
                    $(".change_nav").append(str);
                    $(".change_txt02 a").attr("href", apiUrl + "index.html?BrokerKid=" + GetUrlParam("BrokerKid"));
                    return;
                }
                $.each(data.Items, function (i, obj) {
                    if (obj.F_ProductName.length > 12) {
                        var rename = obj.F_ProductName.substr(0, 12) + "...";
                    } else {
                        var rename = obj.F_ProductName.substr(0, 12);
                    }
                    var dat = obj.F_ExchangeTime.substr(0, 16);
                    var str = "<li style='height:80px;'><a href=\"" + f_Url(obj.Kid, obj.F_ExchangeType) + "\"><div class='change_left'>"
                         + "<div><img src='" + obj.F_PicUrl + "' alt='' width='75' height='50'/></div>"
                         + "</div>"
                         + "<div class='change_right'>"
                         + "   <div class='txt_head'>"
                         + "   <div class='txt_title'>" + rename + "</div>"
                         + "   <div class='txt_status'>" + getStatus(obj.F_IsStatus, obj.F_ExchangeType) + "</div>"
                         + "</div>"
                         + " <div class='txt_price'>" + obj.F_PointNum + "</div>"
                         + " <div class='txt_data'>" + dat + "</div>"
                         + " </div></a></li>";
                    $(".change_nav").append(str);
                });
            });
        });
        function getStatus(state, exchange) {
            if (exchange == "幸运大转盘") {
                switch (state) {
                    case 1: return "审核中";
                    case 2: return "兑换处理中";
                    case 3: return "抽奖成功";
                    case 4: return "兑换失败";
                    case 5: return "已使用";
                    case 6: return "失效";
                    case 7: return "已过期";
                    case 8: return "已撤销";
                    case 9: return "未发放";
                    case 10: return "已发放";
                }
            }
            if (exchange == "积分兑换") {
                switch (state) {
                    case 1: return "审核中";
                    case 2: return "兑换处理中";
                    case 3: return "兑换成功";
                    case 4: return "兑换失败";
                    case 5: return "已使用";
                    case 6: return "失效";
                    case 7: return "已过期";
                    case 8: return "已撤销";
                    case 9: return "未发放";
                    case 10: return "已发放";
                }
            }
        }

        //跳转链接
        function f_Url(Kid, F_ExchangeType) {
            return apiUrl + "reward_history.html?kid=" + Kid;
            //if (F_ExchangeType == "幸运大转盘") {
            //    return apiUrl+"reward_history.html?kid=" + Kid;
            //}
            //if (F_ExchangeType == "积分兑换") {
            //    return apiUrl+"goods_detail_history.html?kid=" + Kid;
            //}
            // return "index.html?BrokerKid=" + GetUrlParam("BrokerKid");
            //return "goods_detail.html?ProductKid=" + ProductKid + "&BrokerKid=" + GetUrlParam("BrokerKid");
        }
    </script>
</head>
<body>
    <div class="lay100">
        <div class="change">
            <ul class="change_nav">
                <!--  <li>
                      <div class="change_left">
                          <div><img src="images/pic1.jpg" alt="" width="80" /></div>
                      </div>
                      <div class="change_right">
                          <div class="txt_head">
                              <div class="txt_title">小米耳机购买券</div>
                              <div class="txt_price">600</div>
                          </div>
                          <div class="txt_code">券码:332456978</div>
                          <div class="txt_data">2015-12-31日后过期</div>
                      </div>
                  </li>
                  <li>
                      <div class="change_left">
                          <div><img src="images/pic4.jpg" alt="" width="80" /></div>
                      </div>
                      <div class="change_right">
                          <div class="txt_head">
                              <div class="txt_title">抢年货</div>
                              <div class="txt_price">50</div>
                          </div>
                          <div class="txt_code"></div>
                          <div class="txt_data">参与抽奖，未中奖...</div>
                      </div>
                  </li>
                  <li>
                      <div class="change_left">
                          <div><img src="images/pic5.jpg" alt="" width="80" /></div>
                      </div>
                      <div class="change_right">
                          <div class="txt_head">
                              <div class="txt_title">约车券</div>
                              <div class="txt_price">100</div>
                          </div>
                          <div class="txt_code"></div>
                          <div class="txt_data">请在个人中心 约车券中查看...</div>
                      </div>
                  </li>-->
            </ul>
        </div>
    </div>
    <div class="modal fade" id="showMesBox" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">兑奖记录</h4>
                </div>
                <div class="modal-body table-responsive">
                    <table class="table table-striped">
                        <tr><td>商品详情：</td><td>1111</td></tr>
                        <tr><td>商品详情：</td><td>1111</td></tr>
                        <tr><td>商品详情：</td><td>1111</td></tr>
                        <tr><td>商品详情：</td><td>1111</td></tr>
                    </table>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <script>
    var page = 2;
    // dropload
     var flag = true
    function getData() {
        kk.api.get(apiUrl + "/ProductsExchange/GetBrokerKidByList", { pageIndex: page++, pageSize: 10 }, function (data) {
            $.each(data.Items, function (i, obj) {
                if (obj.F_ProductName.length > 12) {
                    var rename = obj.F_ProductName.substr(0, 12) + "...";
                } else {
                    var rename = obj.F_ProductName.substr(0, 12);
                }
                var dat = obj.F_ExchangeTime.substr(0, 16);
                var str = "<li style='height:80px;'><a href=\"" + f_Url(obj.Kid, obj.F_ExchangeType) + "\"><div class='change_left'>"
                     + "<div><img src='" + obj.F_PicUrl + "' alt='' width='75' height='50'/></div>"
                     + "</div>"
                     + "<div class='change_right'>"
                     + "   <div class='txt_head'>"
                     + "   <div class='txt_title'>" + rename + "</div>"
                     + "   <div class='txt_status'>" + getStatus(obj.F_IsStatus, obj.F_ExchangeType) + "</div>"
                     + "</div>"
                     + " <div class='txt_price'>" + obj.F_PointNum + "</div>"
                     + " <div class='txt_data'>" + dat + "</div>"
                     + " </div></a></li>";
                $(".change_nav").append(str);
            });
            flag = true;
            $('body').animate({ top: "0px" });
            if (data.Items.length < 5) {
                $(".no_more").show();
            }
            //me.resetload();

        });
    }

    window.onscroll = function () {
        if (document.documentElement.clientHeight < document.documentElement.offsetHeight - 4 && flag) {
            flag = false;
            getData()
        }
    }

    //$(document).on("click", ".change_nav li", function () {
    //    $("#showMesBox").modal('show')
    //    return false;
    //})
    </script>

</body>
</html>
